<?php
	require_once dirname(__FILE__) . '/../../utils/Utils.php';
	//引入公共参数
	$constant = include(dirname(__FILE__) . '/../../AppletConstant.php');

	$utils =	new Utils();

	/**
	 *  激活小程序会员卡
	 *
	 */

	//调用地址
	$url = "https://open.95516.com/open/access/1.0/activeMemberCard";
	//拼装参数Map
	$params 	=	array();
	$params["appId"] 				=	$constant['appId'];

	//会员卡模板id
	$params["cardTemplateId"] = "";

	$params["openId"] = $constant['openId'];

	//会员卡code
	$params["upMemberCardNo"] = "";

	//会员卡编号
	$params["merchantMemberCardNo"] = "";

	//初始积分
	$params["initBonus"] = "";

	//初始余额
	$params["initBalance"] = "";

	//初始等级
	$params["initLevel"] = "";

	//自定义场景值
	$params["source"] = "";

	//是否为新会员
	$params["IsNewMembership"] = "";
	
	//随机字符串
	$nonceStr = $utils->createNonceStr();
	$params["nonceStr"] =	$nonceStr;

	//时间戳
	$timestamp = time();
	$params["timestamp"] =	$timestamp;

	//签名
	$signature = $utils->sign($params, $constant['SIGN_KEY_PACKET']);
    $params["signature"]=$signature;

	//对称密钥加密
	$params = $utils->encryptedParamMap($constant['SYMMETRIC_KEY'], $params, array("upMemberCardNo","merchantMemberCardNo","initBonus","initBalance"));

	//发送请求
	$resultStr 	=	$utils->sendPostGson($url,$params);
	print_r("-------获取激活小程序会员卡信息: ".$resultStr." --------- ");
    exit();
	
?>
